import java.text.DateFormatSymbols;
import java.util.Scanner;
import java.util.Calendar;

public class Task4 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Calendar calen = Calendar.getInstance();
		Scanner inp = new Scanner(System.in);
		System.out
				.println("Please input date using next format: day month year");
		String inp1 = inp.nextLine();
		String[] yyy = new DateFormatSymbols().getMonths();
		int[] data_inp = new int[3];
		int s = 0;
		for (String b : inp1.split(" ")) {
			try {
				if (b.isEmpty() != true) {
					if ((s == 1) && (b.length() > 2)) {
						for (int g = 0; g < 12; g++) {
							if (b.equalsIgnoreCase(yyy[g])) {
								data_inp[1] = g + 1;
								break;
							} else if (g == 11)
								throw new NumberFormatException();
						}
					} else
						data_inp[s] = Integer.parseInt(b);
					s++;
				}

			} catch (java.lang.NumberFormatException e) {
				System.out.print("Input isn't correct");
				System.exit(1);
			}
		}
		int day = data_inp[0];
		int mon = data_inp[1];
		int year = data_inp[2];
		calen.set(day, mon, year);
		int daym_max = calen.getActualMaximum(Calendar.DAY_OF_MONTH);
		try {
			if (day > daym_max) { // verifying that days count isn't more than
									// real
				System.out.println("The maximum days in " + yyy[mon - 1]
						+ " is " + daym_max);
				System.exit(1);
			}
			boolean isLeap = (year % 4 == 0) && (year % 100 != 0);
			boolean isLeap400 = (year % 400 == 0);
			int[] day_in_month = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31,
					30, 31 };
			int day_all = 0;
			int day_rest = 0;
			for (int i = 1; i < mon; i++)
				day_rest += day_in_month[i];
			int leap_days = (year - 1) / 4 - (year - 1) / 100 + (year - 1)
					/ 400;
			day_all = (year - 1) * 365 + leap_days + day + day_rest;
			if (isLeap || isLeap400) {
				if (mon > 2) {
					day_all += 1;
				}
			}
			switch ((day_all + 2) % 7) {
			case 0:
				System.out.println("It's Friday");
				break;
			case 1:
				System.out.println("It's Saturday");
				break;
			case 2:
				System.out.println("It's Sunday");
				break;
			case 3:
				System.out.println("It's Monday");
				break;
			case 4:
				System.out.println("It's Tuesday");
				break;
			case 5:
				System.out.println("It's Wednesday");
				break;
			case 6:
				System.out.println("It's Thursday");
				break;
			}
		} catch (java.lang.ArrayIndexOutOfBoundsException e) {
			System.out.print("Input isn't correct");
		}
	}
}
